package com.kfly.Seria;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.Serializable;

public class Employee implements Serializable {
	 int employeeId;
	 String employeeName;
	 String department;
	 transient Address address;
	  
	 public int getEmployeeId() {
	  return employeeId;
	 }
	 public void setEmployeeId(int employeeId) {
	  this.employeeId = employeeId;
	 }
	 public String getEmployeeName() {
	  return employeeName;
	 }
	 public void setEmployeeName(String employeeName) {
	  this.employeeName = employeeName;
	 }
	 public String getDepartment() {
	  return department;
	 }
	 public void setDepartment(String department) {
	  this.department = department;
	 }
	 public Address getAddress() {
	  return address;
	 }
	 public void setAddress(Address address) {
	  this.address = address;
	 }
	 
	 private void writeObject(ObjectOutputStream os){
		 try {
			os.defaultWriteObject();
			os.writeInt(address.getHomeNo());
			os.writeObject(address.getCity());
			os.writeObject(address.getStreet());
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		 
		 
	 }
	 private void readObject(ObjectInputStream ois){
		 
		 try {
			ois.defaultReadObject();
			int no = ois.readInt();
			String city = (String)ois.readObject();
			String street = (String)ois.readObject();
			address = new Address(no, street, city);
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		 
	 }

}
